<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">版本更新</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-edit"
                                         actionListener="#{updateVersionInfoBean.changeStatusToEdit}"
                                         process="@this"
                                         update="@form"
                                         rendered="#{updateVersionInfoBean.$.status == 0}"/>
                        <p:commandButton value="保存" icon="fa fa-save"
                                         action="#{updateVersionInfoBean.onSave()}"
                                         update="@form"
                                         rendered="#{updateVersionInfoBean.isAdd() || updateVersionInfoBean.isEdit()}"/>
                        <p:commandButton value="取消" icon="fa fa-reply"
                                         actionListener="#{updateVersionInfoBean.changeStatusToView}"
                                         rendered="#{updateVersionInfoBean.isEdit()}"
                                         process="@this"
                                         update="@form"/>
                        <p:button value="返回" icon="fa fa-reply-all" href="#{currentUserBean.back}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-fluid" style="padding-top: 30px;">
                <div class="ui-g">
                    <div class="ui-g-12">
                        <div class="card ui-g-12">
                            <h3><b>基本信息</b></h3>
                            <p:panelGrid columns="4" layout="grid"
                                         columnClasses="ui-grid-col-1,ui-grid-col-5,ui-grid-col-1,ui-grid-col-5"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;text-align:left;">

                                <p:outputLabel for="version_no" value="更新版本序号"/>
                                <p:inputText id="version_no" disabled="#{updateVersionInfoBean.isView()}"
                                             value="#{updateVersionInfoBean.$.versionNo}"/>

                                <p:outputLabel for="update_type" value="选择更新类型"/>
                                <p:selectOneMenu id="update_type" disabled="#{updateVersionInfoBean.isView()}"
                                             value="#{updateVersionInfoBean.$.updateType}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="非强制" itemValue="0"/>
                                    <f:selectItem itemLabel="强制" itemValue="1"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="product_ids" value="选择产品id"/>
                                <p:selectCheckboxMenu id="product_ids" disabled="#{updateVersionInfoBean.isView()}"
                                                      value="#{updateVersionInfoBean.$.prdIds}"
                                                      updateLabel="true" multiple="true" filter="true"
                                                      filterMatchMode="contains">
                                    <f:selectItems
                                            value="#{updateVersionInfoBean.commProductIds}"
                                            var="product"
                                            itemLabel="#{product.name}(#{product.productId})" itemValue="#{product.productId}"/>
                                </p:selectCheckboxMenu>

                                <p:outputLabel for="is_corner_icon_show" value="左上角人头icon是否显示"/>
                                <p:selectOneMenu id="is_corner_icon_show" disabled="#{updateVersionInfoBean.isView()}"
                                                 value="#{updateVersionInfoBean.$.isCornerIconShow}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                    <f:selectItem itemLabel="否" itemValue="0"/>
                                    <f:selectItem itemLabel="是" itemValue="1"/>
                                </p:selectOneMenu>

                                <p:outputLabel for="content" value="更新提示文案"/>
                                <p:inputTextarea id="content" disabled="#{updateVersionInfoBean.isView()}"
                                             value="#{updateVersionInfoBean.$.content}"/>
                            </p:panelGrid>
                        </div>
                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>